<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Category
 *
 * @author jianfeng
 */
class Category {

    public $owner;

    public function __construct($owner = NULL) {
        if ($owner != NULL)
            $this->owner = $owner;
    }    
    public function getRoot(){
        //first determind whether root exist
        $count = $tourBoxDb->getCount($category,  $this->owner);        
        if($count == 0){
            //not exist, add first row
            $tourBoxDb->addRow($rowData);
        }
        //get first row for category and owner
        $row = $tourBoxDb->getFirstRow($category,  $this->owner);
        $rootCategory = new Category($this->owner);
        $rootCategory->load($row);
        return $rootCategory;
    }
    public function getOwner();
    public function setOwner($owner);
    public function getChild($findContext = NULL);
    public function getChildren($findContext = NULL);
    public function getParent();
    public function addChild($child);
    public function removeChild($child);
    public function getMembers($findContext = NULL);
    public function getMember($findContext = NULL);
    public function addMember($member = NULL);
    public function removeMember($member = NULL);    
    public function load($data = NULL);
}
